package com.ohuang.demo.webView

import android.webkit.WebSettings
import android.webkit.WebView
import android.webkit.WebViewClient

/**
 * webView默认设置
 */
fun WebView.defaultSetting() {

    // 启用JavaScript
    settings.setJavaScriptEnabled(true)

    // 启用DOM存储
    settings.domStorageEnabled = true

    // 启用数据库
    settings.databaseEnabled = true

    // 启用缓存
    settings.cacheMode = WebSettings.LOAD_DEFAULT

    // 设置默认的文本编码
    settings.defaultTextEncodingName = "UTF-8"

    // 支持缩放
    settings.setSupportZoom(true)
    settings.builtInZoomControls = true
    settings.displayZoomControls = false

    // 启用多窗口
    settings.setSupportMultipleWindows(true)

    // 启用地理定位
    settings.setGeolocationEnabled(true)


    // 设置WebViewClient以处理页面加载
    webViewClient = WebViewClient()



}